package com.wyr.dynamic_proxy.cglib;

import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Enhancer;

public class EnhancerMain {
    private Enhancer enhancer = new Enhancer();//组合方式

    //定义额外逻辑，也就是代理逻辑
    public void setCallbacks(Callback[] callbacks){
        enhancer.setCallbacks(callbacks);
    }
    //设置父类
    public void setSuperClass(Class superclass){
        enhancer.setSuperclass(superclass);
    }
    //创建代理对象
    public Object create(){
       return enhancer.create();
    }
}
